/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.minhphuong.controllers;

import com.minhphuong.bll.HelperBLL;
import com.minhphuong.bll.HoaDonBLL;
import com.minhphuong.bll.SanPhamBLL;
import com.minhphuong.bll.TinhTrangSanPhamBLL;
import com.minhphuong.bll.TrangThaiHoaDonBLL;
import com.minhphuong.entities.HoaDon;
import com.minhphuong.entities.SanPham;
import com.minhphuong.entities.TinhTrangSanPham;
import com.minhphuong.entities.TrangThaiHoaDon;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 *
 * @author home
 */
@Controller
public class DonHangController {

    @RequestMapping(value = "/DonHang/", method = RequestMethod.GET)
    public String DonHang(ModelMap map, HttpSession session) {
        HelperBLL.LoadGiaoDien(map, session);
        List<SanPham> listSanPham = SanPhamBLL.getAllSanPham();
        map.addAttribute("listSanPham", listSanPham);

        List<HoaDon> listHoaDon = HoaDonBLL.getAllHoaDon();
        map.addAttribute("listHoaDon", listHoaDon);

        List<TrangThaiHoaDon> listTTHD = TrangThaiHoaDonBLL.getAllTTHD();
        map.addAttribute("listTTHD", listTTHD);
        List<TinhTrangSanPham> listTTSP = TinhTrangSanPhamBLL.getALLTTSP();
        map.addAttribute("listTTSP", listTTSP);
        return "admin_hoadon";
    }
}
